package transport.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.EventLoopGroup;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import transport.ChannelUtils;

import java.io.*;

public abstract class WriteHandler extends ChannelInboundHandlerAdapter {
    protected Logger LOG = LoggerFactory.getLogger(WriteHandler.class);
    protected String storagePath;
    protected EventLoopGroup aGroup;
    protected EventLoopGroup wGroup;

    public WriteHandler(String storagePath, EventLoopGroup aGroup, EventLoopGroup wGroup) throws FileNotFoundException {
        this.aGroup = aGroup;
        this.wGroup = wGroup;
        this.storagePath = storagePath;
    }


    protected void shutDown(){
        aGroup.shutdownGracefully();
        wGroup.shutdownGracefully();
    }
}
